package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.entity.BlogComments;
import com.hmdp.service.IBlogCommentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/blog-comments")
public class BlogCommentsController {
    @Autowired
    private IBlogCommentsService blogCommentsService;
    @GetMapping("/{blogId}")
    public Result getCommentsByBlogId(@PathVariable("blogId") Long blogId){
        List<BlogComments> blogComments = blogCommentsService.showComments(blogId);
        return Result.ok(blogComments);
    }
}
